/*
 * @Author       : shenqing
 * @desc         : 组件描述
 * @Date         : 2022-10-14 11:17:24
 * @LastEditTime : 2022-10-14 11:18:13
 * @LastEditors  : shenqing
 * @FilePath     : \questionnaire\src\plugins\directive.js
 */

let img = require('@/assets/images/default-avatar.png')
export default {
    install(Vue, options) {
        Vue.directive('default-avatar', {
            bind: function (el) {
                if (!el.src) {
                    el.src = img
                    return
                }
                el.onerror = function () {
                    el.src = img
                }
            },
        })
    }
}
